﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.iRods.Packets;

namespace Renci.iRods.Common
{
    internal class ObjectStatus
    {
        public double Size { get; private set; }

        public ObjectTypes ObjectType { get; private set; }

        public int Mode { get; private set; }

        public string ID { get; private set; }

        public string Checksum { get; private set; }

        public string OwnerName { get; private set; }

        public string OwnerZone { get; private set; }

        public DateTime CreatedTime { get; private set; }

        public DateTime ModifiedTime { get; private set; }

        public ErrorCodes ErrorCode { get; private set; }

        public ObjectStatus(ObjectStatusPacket objectStatusPacket, ErrorCodes errorCode)
        {
            this.ErrorCode = errorCode;

            if (errorCode == ErrorCodes.None)
            {
                this.Size = objectStatusPacket.ObjectSize;
                this.ObjectType = objectStatusPacket.ObjectType;
                this.Mode = objectStatusPacket.Mode;
                this.ID = objectStatusPacket.DataID;
                this.Checksum = objectStatusPacket.Checksum;
                this.OwnerName = objectStatusPacket.OwnerName;
                this.OwnerZone = objectStatusPacket.OwnerZone;
                this.CreatedTime = objectStatusPacket.CreatedTime;
                this.ModifiedTime = objectStatusPacket.ModifiedTime;
            }
        }
    }
}
